package org.longteng.mobileluck.controller;

import lombok.extern.slf4j.Slf4j;
import org.longteng.sys.ComputerInfoUtil;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * 车牌号吉祥页面mvc  action
 */
@Controller
@Slf4j
public class ThyCartLuckController {
    /**
     * 到车牌号吉祥主页面
     * @param model
     * @param request
     * @return
     */
    @RequestMapping("/car")
    public String cartIndexPage(Model model, HttpServletRequest request){
        String openid = request.getParameter("openid");
        log.info("到车牌号吉祥主页面,openid:{}", openid);

        return "cartpage/index";
    }

    /**
     * 到车牌号吉祥测算页面
     * @param model
     * @param request
     * @return
     */
    @RequestMapping("/cartluck")
    public String cartluckPage(Model model, HttpServletRequest request){
        String openid = request.getParameter("openid");
        log.info("到车牌号吉祥测算页面,openid:{}", openid);

        return "cartpage/cartluck";
    }

    /**
     * 转到生成自选车牌号页面
     * @param model
     * @param request
     * @return
     */
    @RequestMapping("/cartnumlist")
    public String mobileSelImgPage(Model model, HttpServletRequest request){
        String openid = request.getParameter("openid");
        boolean clientIsMoblie = ComputerInfoUtil.clientIsMoblie(request); // 是否手机端
        model.addAttribute("clientIsMoblie",clientIsMoblie);
        log.info("转到生成自选车牌号页面,clientIsMoblie:{}", clientIsMoblie);

        return "cartpage/cart_mark_list";
    }

    /**
     * License车牌号选号上传-帮助吉祥选号页面
     * @param model
     * @param request
     * @return
     */
    @RequestMapping("/cartnumpic")
    public String cartPlateNumSelImgPage(Model model, HttpServletRequest request){
        String openid = request.getParameter("openid");
        boolean clientIsMoblie = ComputerInfoUtil.clientIsMoblie(request);
        model.addAttribute("clientIsMoblie",clientIsMoblie);
        log.info("到车牌选号上传-帮助吉祥选号页面,clientIsMoblie:{}", clientIsMoblie);

        return "cartpage/cart_img_upload";
    }
}
